#include <stdio.h>

typedef struct
{
    int id;
    char name[20];
    int age;
}student;
int main()
{   
    //文件指针
    FILE*f = fopen("test.txt","r");

    if(f == NULL)
    {
        printf("文件打开失败!\n");
        return -1;
    }
    printf("文件打开成功!\n");

    
//    student stu;
     //从文件中格式化读取数据 
//    fscanf(f,"%d %s %d",&stu.id,stu.name,&stu.age);
//    printf("学生信息:%d %s %d\n",stu.id,stu.name,stu.age);

      //将指针移到距离开头6个字节的位置
      fseek(f,0,SEEK_END);
      char str[1024] = {0};
      //fseek(f,0,SEEK_SET)
      //把文件指针返回文件开头
      rewind(f);
      fread(str,1024,1,f);
      printf("%d\n",ftell(f));
    

    

    fclose(f);
    return 0;
}